//2009/08/23 02:07:01
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class MnemonicMemory
{
public:
    string getPhrase(string number, vector <string> dic)
    {
		vector<bool> used(dic.size(), false);
		sort(dic.begin(), dic.end());
		string s = "";
		for(int i=0; i<number.size(); i++)
		{
			int length = number[i] - '0';
			for(int j=0; j<dic.size(); j++)
			{
				if(used[j]==false && dic[j].size() == length)
				{
					s += " " + dic[j];
					used[j] = true;
					break;
				}
			}
		}
		return s.substr(1);
    }
};
